<template>
	<view class="px4">
		<u-form :model="view" ref="uForm">
			<u-form-item prop="content" label-position="top">
				<u-input v-model:modelValue="formData.content" type="textarea" placeholder="请输入您的投诉或建议,不超过200字." maxlength="200" height="150" :border="false" :custom-style="{padding:'8px','background-color':'#ffffff'}" :clearable="false" />
			</u-form-item>
		</u-form>
		<view class="m2">
		  <button @click="submit" :disabled="handing" :loading="handing" type="primary">提交</button>
		</view>
		<List>
			<view v-for="(item, i) in list" :key="i" class="bgw p4 br2 mt4">
				<view>{{item.content}}</view>
				<view class="py3 c9">{{filter.date(item.create_at)}}</view>
			</view>
		</List>
	</Theme>
</template>
<script lang="ts">
import util from '@/utils/util'
import {page,list,form} from '@/mixins'
export default {
	mixins: [page,list,form],
	data() {
		return {
			meta:{title:'我的反馈'},
			view: {content: ''},
			rules: {
				content: [{
					required: true,
					message: '请输入内容',
					trigger: ['change', 'blur'],
				}]
			},
			loadPath: 'my/feedback',
			formPath: 'my/feedback'
		}
	},
	methods: {
		afterSubmit(res){
			util.msg('提交成功', 'success')
			res.create_at = (new Date).getTime()
			this.list.unshift(res)
			this.formData.content = ''
		}
	}
}
</script>
